<?php declare(strict_types=1);
/**
 * @author      xianganyall <xianganyall@gmail.com>
 * @copyright   2023-2025 owner
 **/

namespace Srv\Libs\Frame;

use Srv\Libs\Common\CommArray;
use Srv\Libs\Common\CommJson;
use Srv\Libs\Common\CommString;
use Srv\Libs\Common\CommTime;
use Srv\Libs\Common\CommValid;

final class CheckDTO
{
    public const VALID_IP                       = 1;                    // IP地址
    public const VALID_IPv6                     = 2;                    // IPv6地址
    public const VALID_MAC                      = 3;                    // MAC地址
    public const VALID_TIME                     = 4;                    // 时间
    public const VALID_DATE                     = 5;                    // 日期
    public const VALID_DATE_TIME                = 6;                    // 日期+时间
    public const VALID_EMAIL                    = 7;                    // Email
    public const VALID_MOBILE                   = 8;                    // 手机号
    public const VALID_PHONE                    = 9;                    // 座机号
    public const VALID_IDCARD                   = 10;                   // 身份证号
    public const VALID_AGE                      = 11;                   // 年龄
    public const VALID_GENDER                   = 12;                   // 性别
    public const VALID_CHINESE                  = 13;                   // 仅中文
    public const VALID_ENGLISH                  = 14;                   // 仅英文
    public const VALID_NUMBER                   = 15;                   // 仅数字
    public const VALID_ENGLISH_NUMBER           = 16;                   // 仅英文+数字
    public const VALID_HTTP                     = 17;                   // http链接地址
    public const VALID_HTTPS                    = 18;                   // https链接地址
    public const VALID_HTTP_HTTPS               = 19;                   // http+https链接地址
    public const VALID_HTTP_ALL                 = 20;                   // 全链接地址
    public const VALID_QQ                       = 21;                   // QQ号码
    public const VALID_POST_CODE                = 22;                   // 邮政编号
    public const VALID_DOMAIN_EN                = 23;                   // 英文域名
    public const VALID_DOMAIN_CN                = 24;                   // 中文域名
    public const VALID_HOST_NAME_EN             = 25;                   // 英文主机名
    public const VALID_HOST_NAME_CN             = 26;                   // 中文主机名
    public const VALID_TIME_STAMP               = 27;                   // 时间秒
    public const VALID_TIME_MILLI               = 28;                   // 时间毫秒
    public const VALID_UUID                     = 29;                   // UUID[8-4-4-4-12]
    public const VALID_VERSION                  = 30;                   // 版本字符串[1.0.0]
    public const VALID_POS_LNG                  = 31;                   // 位置经度[123.123456]
    public const VALID_POS_LAT                  = 32;                   // 位置纬度[12.123456]
    public const VALID_APPLE_ID                 = 33;                   // 苹果唯一Key[IDFA或IDFV]
    public const VALID_ANDROID_IMEI             = 34;                   // 安卓IMEI
    public const VALID_ANDROID_SN               = 35;                   // 安卓SN
    public const VALID_ANDROID_OAID             = 36;                   // 安卓OAID
    public const VALID_WEB3_ADDRESS             = 37;                   // Web3地址
    public const VALID_WEB3_HASH                = 42;                   // Web3交易Hash
    public const VALID_MD5_LOWER                = 38;                   // md5小写值
    public const VALID_MD5_UPPER                = 39;                   // md5大写值
    public const VALID_SHA1_LOWER               = 40;                   // sha1小写值
    public const VALID_SHA1_UPPER               = 41;                   // sha1大写值
    public const VALID_VERSION_FULL             = 42;                   // 版本字符串[1.0.0.1]
    public const VALID_ANDROID_GAID             = 43;                   // 安卓GAID

    public const CHECK_TYPE_VALID               = 'Valid';              // 检查类型-验证           @["VALID_EMAIL"] @["VALID_IP"]
    public const CHECK_TYPE_NUMBER              = 'Number';             // 检查类型-数字           @["Number",1,"MAX"]
    public const CHECK_TYPE_NUMBER_STR_LEN      = 'NumberStrLen';       // 检查类型-数字字符串内容   @["NumberStrLen", 1, 16]
    public const CHECK_TYPE_NUMBER_STR_INT      = 'NumberStrInt';       // 检查类型-数字字符串数     @["NumberStrInt",1,"MAX"]
    public const CHECK_TYPE_STRING              = 'String';             // 检查类型-字符串          @["String",1,"MAX"]
    public const CHECK_TYPE_FLOAT               = 'Float';              // 检查类型-浮点数          @["Float",1.0,"MAX",1,"MAX"]
    public const CHECK_TYPE_FLOAT_STR           = 'FloatStr';           // 检查类型-浮点数字符串     @["FloatStr","2.002","9.109",1,"MAX"]
    public const CHECK_TYPE_ENUM                = 'Enum';               // 检查类型-玫举            @["Enum",[1,2,3],true] @["Enum",["man","woman","other"],false]
    public const CHECK_TYPE_BOOL                = 'Bool';               // 检查类型-Bool           @["Bool",true,true]
    public const CHECK_TYPE_ARRAY               = 'Array';              // 检查类型-数组-混合        @["Array",1,150]
    public const CHECK_TYPE_ARRAY_NUM           = 'ArrayNum';           // 检查类型-数组-数字        @["ArrayNum",1,150,1,"MAX"]
    public const CHECK_TYPE_ARRAY_STR           = 'ArrayStr';           // 检查类型-数组-字符串      @["ArrayStr",1,150,1,"MAX"]
    public const CHECK_TYPE_ARRAY_FLOAT         = 'ArrayFloat';         // 检查类型-数组-浮点数      @["ArrayFloat",1,150,1.002,999.009,1,"MAX"]
    public const CHECK_TYPE_ARRAY_FLOAT_STR     = 'ArrayFloatStr';      // 检查类型-数组-浮点数字符串 @["ArrayFloatStr",1,150,"2.002","9.109",1,12]
    public const CHECK_TYPE_ARRAY_ENUM          = 'ArrayEnum';          // 检查类型-数组-玫举        @["ArrayEnum",1,150,[1,2,3],true]
    public const CHECK_TYPE_ARRAY_BOOL          = 'ArrayBool';          // 检查类型-数组-Bool       @["ArrayBool",1,150,[true,false,true],true]
    public const CHECK_TYPE_CLASS_ENUM          = 'EnumType';           // 检查类-枚举              @["EnumType",{"noZero":true}]
    public const CHECK_TYPE_CLASS_ARRAY_ENUM    = 'ArrayEnumType';      // 检查类-数组-枚举          @["ArrayEnumType",1,"MAX",{"null":false,"noZero":false,"onlyList":[],"notList":[]}]
    public const CHECK_TYPE_CLASS_MESSAGE       = 'MessageType';        // 检查类-对象              @["MessageType",{"null":false}]
    public const CHECK_TYPE_CLASS_ARRAY_MESSAGE = 'ArrayMessageType';   // 检查类-数组-对象          @["ArrayMessageType",1,"MAX",{"null":false}]
    public const FLOAT_DOT_MAX_NUM              = 14;                   // 浮点数最大小数位数
    public const FLOAT_DOT_MIN_NUM              = 0;                    // 浮点数最小小数位数
    private static array $checkParamList        = [];                   // 检查参数列表
    private static array $optionalNameList      = [];                   // 可选参数名列表

    /**
     * @param string $validName
     * @return int
     * getValidNameId
     */
    final public static function getValidNameId(string $validName):int
    {
        $validNameList                  = [
            'VALID_IP'                  => 1,
            'VALID_IPv6'                => 2,
            'VALID_MAC'                 => 3,
            'VALID_TIME'                => 4,
            'VALID_DATE'                => 5,
            'VALID_DATE_TIME'           => 6,
            'VALID_EMAIL'               => 7,
            'VALID_MOBILE'              => 8,
            'VALID_PHONE'               => 9,
            'VALID_IDCARD'              => 10,
            'VALID_AGE'                 => 11,
            'VALID_GENDER'              => 12,
            'VALID_CHINESE'             => 13,
            'VALID_ENGLISH'             => 14,
            'VALID_NUMBER'              => 15,
            'VALID_ENGLISH_NUMBER'      => 16,
            'VALID_HTTP'                => 17,
            'VALID_HTTPS'               => 18,
            'VALID_HTTP_HTTPS'          => 19,
            'VALID_HTTP_ALL'            => 20,
            'VALID_QQ'                  => 21,
            'VALID_POST_CODE'           => 22,
            'VALID_DOMAIN_EN'           => 23,
            'VALID_DOMAIN_CN'           => 24,
            'VALID_HOST_NAME_EN'        => 25,
            'VALID_HOST_NAME_CN'        => 26,
            'VALID_TIME_STAMP'          => 27,
            'VALID_TIME_MILLI'          => 28,
            'VALID_UUID'                => 29,
            'VALID_VERSION'             => 30,
            'VALID_POS_LNG'             => 31,
            'VALID_POS_LAT'             => 32,
            'VALID_APPLE_ID'            => 33,
            'VALID_ANDROID_IMEI'        => 34,
            'VALID_ANDROID_SN'          => 35,
            'VALID_ANDROID_OAID'        => 36,
            'VALID_WEB3_ADDRESS'        => 37,
            'VALID_WEB3_HASH'           => 42,
            'VALID_MD5_LOWER'           => 38,
            'VALID_MD5_UPPER'           => 39,
            'VALID_SHA1_LOWER'          => 40,
            'VALID_SHA1_UPPER'          => 41,
            'VALID_VERSION_FULL'        => 42,
            'VALID_ANDROID_GAID'        => 43,
        ];
        return $validNameList[$validName]??0;
    }

    /**
     * @param array $optionalNameList
     * 设置初始运行数据
     */
    final public static function init(array $optionalNameList = []):void
    {
        self::$checkParamList       = [];
        self::$optionalNameList     = $optionalNameList;
    }

    /**
     * @param string $optionalName
     * @return bool
     * 是否是可选参数
     */
    final public static function isOptionalName(string $optionalName):bool
    {
        return in_array($optionalName, self::$optionalNameList, true);
    }

    /**
     * @param string $paramName
     * @return bool
     * 是否是参数名
     */
    private static function isParamName(string $paramName):bool
    {
        if(strlen($paramName) < 1) return false;
        $firstCharOrd   = ord(substr($paramName, 0, 1));
        if($firstCharOrd >= 97 && $firstCharOrd <= 122) return true; // 小写字母开头
        return false;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNumber
     * @param int $maxNumber
     * @return bool
     * 设置检查参数-数字
     */
    final public static function setNumber(string $paramName, int $errCode, string $errMsg, int $minNumber, int $maxNumber):bool
    {
        if($minNumber > $maxNumber || !self::isParamName($paramName)) return false;
        self::$checkParamList[]     = [self::CHECK_TYPE_NUMBER, $paramName, $errCode, $errMsg, $minNumber, $maxNumber];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minLength
     * @param int $maxLength
     * @return bool
     * 设置检查参数-数字字符串内容
     */
    final public static function setNumberStrLen(string $paramName, int $errCode, string $errMsg, int $minLength, int $maxLength):bool
    {
        if($minLength > $maxLength || !self::isParamName($paramName)) return false;
        self::$checkParamList[]     = [self::CHECK_TYPE_NUMBER_STR_LEN, $paramName, $errCode, $errMsg, $minLength, $maxLength];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNumber
     * @param int $maxNumber
     * @return bool
     * 设置检查参数-数字字符串数
     */
    final public static function setNumberStrInt(string $paramName, int $errCode, string $errMsg, int $minNumber, int $maxNumber):bool
    {
        if($minNumber > $maxNumber || !self::isParamName($paramName)) return false;
        self::$checkParamList[]     = [self::CHECK_TYPE_NUMBER_STR_INT, $paramName, $errCode, $errMsg, $minNumber, $maxNumber];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minLength
     * @param int $maxLength
     * @return bool
     * 设置检查参数-字符串
     */
    final public static function setString(string $paramName, int $errCode, string $errMsg, int $minLength, int $maxLength):bool
    {
        if($minLength > $maxLength || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_STRING, $paramName, $errCode, $errMsg, $minLength, $maxLength];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param float $minNumber
     * @param float $maxNumber
     * @param int $dotMinLength
     * @param int $dotMaxLength
     * @return bool
     * 设置检查参数-浮点数
     */
    final public static function setFloat(string $paramName, int $errCode, string $errMsg, float $minNumber, float $maxNumber, int $dotMinLength, int $dotMaxLength):bool
    {
        if($minNumber > $maxNumber || $dotMinLength < 1 || $dotMaxLength < 1 || $dotMinLength > self::FLOAT_DOT_MAX_NUM || $dotMaxLength > self::FLOAT_DOT_MAX_NUM || $dotMinLength > $dotMaxLength || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_FLOAT, $paramName, $errCode, $errMsg, $minNumber, $maxNumber, $dotMinLength, $dotMaxLength];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param string $minNumber
     * @param string $maxNumber
     * @param int $dotMinLength
     * @param int $dotMaxLength
     * @return bool
     * 设置检查参数-浮点数字符串
     */
    final public static function setFloatStr(string $paramName, int $errCode, string $errMsg, string $minNumber, string $maxNumber, int $dotMinLength, int $dotMaxLength):bool
    {
        if($minNumber > $maxNumber || $dotMinLength < 1 || $dotMaxLength < 1 || $dotMinLength > self::FLOAT_DOT_MAX_NUM || $dotMaxLength > self::FLOAT_DOT_MAX_NUM || $dotMinLength > $dotMaxLength || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_FLOAT_STR, $paramName, $errCode, $errMsg, $minNumber, $maxNumber, $dotMinLength, $dotMaxLength];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param array $enumList
     * @param bool $isStrict
     * @return bool
     * 设置检查参数-枚举
     */
    final public static function setEnum(string $paramName, int $errCode, string $errMsg, array $enumList, bool $isStrict):bool
    {
        if(count($enumList) < 1 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_ENUM, $paramName, $errCode, $errMsg, $enumList, $isStrict];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param bool $isAllowFalse
     * @param bool $isAllowTrue
     * @return bool
     * 设置检查参数-Bool
     */
    final public static function setBool(string $paramName, int $errCode, string $errMsg, bool $isAllowFalse, bool $isAllowTrue):bool
    {
        if(!self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_BOOL, $paramName, $errCode, $errMsg, $isAllowFalse, $isAllowTrue];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNum
     * @param int $maxNum
     * @return bool
     * 设置检查参数-数组
     */
    final public static function setArray(string $paramName, int $errCode, string $errMsg, int $minNum, int $maxNum):bool
    {
        if($minNum > $maxNum || $minNum < 0 || $maxNum < 0 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_ARRAY, $paramName, $errCode, $errMsg, $minNum, $maxNum];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNum
     * @param int $maxNum
     * @param int $minNumber
     * @param int $maxNumber
     * @return bool
     * 设置检查参数-数组-数字
     */
    final public static function setArrayNumber(string $paramName, int $errCode, string $errMsg, int $minNum, int $maxNum, int $minNumber, int $maxNumber):bool
    {
        if($minNum > $maxNum || $minNum < 0 || $maxNum < 0 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_ARRAY_NUM, $paramName, $errCode, $errMsg, $minNum, $maxNum, $minNumber, $maxNumber];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNum
     * @param int $maxNum
     * @param int $minLength
     * @param int $maxLength
     * @return bool
     * 设置检查参数-数组-字符串
     */
    final public static function setArrayStr(string $paramName, int $errCode, string $errMsg, int $minNum, int $maxNum, int $minLength, int $maxLength):bool
    {
        if($minNum > $maxNum || $minNum < 0 || $maxNum < 0 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_ARRAY_STR, $paramName, $errCode, $errMsg, $minNum, $maxNum, $minLength, $maxLength];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNum
     * @param int $maxNum
     * @param float $minNumber
     * @param float $maxNumber
     * @param int $dotMinLength
     * @param int $dotMaxLength
     * @return bool
     * 设置检查参数-数组-浮点数
     */
    final public static function setArrayFloat(string $paramName, int $errCode, string $errMsg, int $minNum, int $maxNum, float $minNumber, float $maxNumber, int $dotMinLength, int $dotMaxLength):bool
    {
        if($minNum > $maxNum || $minNum < 0 || $maxNum < 0 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_ARRAY_FLOAT, $paramName, $errCode, $errMsg, $minNum, $maxNum, $minNumber, $maxNumber, $dotMinLength, $dotMaxLength];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNum
     * @param int $maxNum
     * @param string $minNumber
     * @param string $maxNumber
     * @param int $dotMinLength
     * @param int $dotMaxLength
     * @return bool
     * 设置检查参数-数组-浮点数字符串
     */
    final public static function setArrayFloatStr(string $paramName, int $errCode, string $errMsg, int $minNum, int $maxNum, string $minNumber, string $maxNumber, int $dotMinLength, int $dotMaxLength):bool
    {
        if($minNum > $maxNum || $minNum < 0 || $maxNum < 0 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_ARRAY_FLOAT_STR, $paramName, $errCode, $errMsg, $minNum, $maxNum, $minNumber, $maxNumber, $dotMinLength, $dotMaxLength];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNum
     * @param int $maxNum
     * @param array $enumList
     * @param bool $isStrict
     * @return bool
     * 设置检查参数-数组-枚举
     */
    final public static function setArrayEnum(string $paramName, int $errCode, string $errMsg, int $minNum, int $maxNum, array $enumList, bool $isStrict):bool
    {
        if($minNum > $maxNum || $minNum < 0 || $maxNum < 0 || count($enumList) < 1 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_ARRAY_ENUM, $paramName, $errCode, $errMsg, $minNum, $maxNum, $enumList, $isStrict];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNum
     * @param int $maxNum
     * @param bool $isAllowFalse
     * @param bool $isAllowTrue
     * @return bool
     * 检查类型-数组-Boolean
     */
    final public static function setArrayBool(string $paramName, int $errCode, string $errMsg, int $minNum, int $maxNum, bool $isAllowFalse, bool $isAllowTrue):bool
    {
        if($minNum > $maxNum || $minNum < 0 || $maxNum < 0 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_ARRAY_BOOL, $paramName, $errCode, $errMsg, $minNum, $maxNum, $isAllowFalse, $isAllowTrue];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param string $classNameEnum
     * @param array $checkSet
     * @return bool
     * 检查类-枚举
     */
    final public static function setClassEnum(string $paramName, int $errCode, string $errMsg, string $classNameEnum, array $checkSet):bool
    {
        if(strlen($classNameEnum) < 1 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_CLASS_ENUM, $paramName, $errCode, $errMsg, $classNameEnum, $checkSet];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNum
     * @param int $maxNum
     * @param string $classNameEnum
     * @param array $checkSet
     * @return bool
     * 检查类-数组-枚举
     */
    final public static function setClassArrayEnum(string $paramName, int $errCode, string $errMsg, int $minNum, int $maxNum, string $classNameEnum, array $checkSet):bool
    {
        if($minNum > $maxNum || $minNum < 0 || $maxNum < 0 || strlen($classNameEnum) < 1 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_CLASS_ARRAY_ENUM, $paramName, $errCode, $errMsg, $minNum, $maxNum, $classNameEnum, $checkSet];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param string $classNameMessage
     * @param array $checkSet
     * @return bool
     * 检查类-对象
     */
    final public static function setClassMessage(string $paramName, int $errCode, string $errMsg, string $classNameMessage, array $checkSet):bool
    {
        if(strlen($classNameMessage) < 1 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_CLASS_MESSAGE, $paramName, $errCode, $errMsg, $classNameMessage, $checkSet];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $minNum
     * @param int $maxNum
     * @param string $classNameMessage
     * @param array $checkSet
     * @return bool
     * 检查类-数组-对象
     */
    final public static function setClassArrayMessage(string $paramName, int $errCode, string $errMsg, int $minNum, int $maxNum, string $classNameMessage, array $checkSet):bool
    {
        if($minNum > $maxNum || $minNum < 0 || $maxNum < 0 || strlen($classNameMessage) < 1 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_CLASS_ARRAY_MESSAGE, $paramName, $errCode, $errMsg, $minNum, $maxNum, $classNameMessage, $checkSet];
        return true;
    }

    /**
     * @param string $paramName
     * @param int $errCode
     * @param string $errMsg
     * @param int $validType
     * @param array $validData
     * @return bool
     * 设置检查参数-验证类型
     */
    final public static function setValid(string $paramName, int $errCode, string $errMsg, int $validType, array $validData = []):bool
    {
        if($validType < 0 || !self::isParamName($paramName)) return false;
        self::$checkParamList[]         = [self::CHECK_TYPE_VALID, $paramName, $errCode, $errMsg, $validType, $validData];
        return true;
    }

    /**
     * @param array $paramData
     * @param string $paramName
     * @param string $paramValueJson
     * @param int $errCode
     * @param string $errMsg
     * @param string $checkType
     * @param bool $isCheckType
     * @return bool
     * 检查参数合法
     */
    final public static function checkParam(array $paramData, string &$paramName, string &$paramValueJson, int &$errCode, string &$errMsg, string &$checkType, bool $isCheckType = true):bool
    {
        if(count(self::$checkParamList) < 1) return true;
        foreach (self::$checkParamList as $itemData){
            $paramName          = $itemData[1];
            if(strlen($paramName) < 1) continue;
            $errCode            = $itemData[2];
            $errMsg             = $itemData[3];
            $checkType          = $itemData[0];
            $isOptional         = self::isOptionalName($paramName);
            $paramValue         = $paramData;
            $isExists           = false;
            $paramNameList      = explode('.', $paramName);
            foreach($paramNameList as $paramNameIndex => $paramNameItem){
                if(strlen($paramNameItem) < 1) return false;
                if($paramNameItem === '*'){
                    $paramNameCount                 = array_count_values($paramNameList);
                    if($paramNameCount['*'] !== 1) return false;
                    $paramNameItemList              = array_slice($paramNameList, $paramNameIndex+1);
                    $paramNameItemForeach           = CommArray::isForeach($paramNameItemList);
                    if(!is_array($paramValue) || count($paramValue) < 1){
                        continue 2;
                    }else{
                        foreach($paramValue as $paramValueIndex => $paramValueItem){
                            if($paramNameItemForeach) foreach($paramNameItemList as $paramNameItemItem){
                                $paramNameItemItemKey   = preg_match('/^\d+$/', $paramNameItemItem) ? intval($paramNameItemItem) : $paramNameItemItem;
                                $isExists               = isset($paramValueItem[$paramNameItemItemKey]);
                                if(!$isExists){
                                    if($isOptional){
                                        continue 2;
                                    }else{
                                        $paramValueJson         = CommJson::encodeArray(['paramValue' => $paramValueItem, 'paramKey' => implode('.', array_slice($paramNameList, 0, $paramNameIndex)).'.'.$paramValueIndex.'.'.implode('.', array_slice($paramNameList, $paramNameIndex+1))]);
                                        return false;
                                    }
                                }
                                $paramValueItem         = $paramValueItem[$paramNameItemItemKey];
                            }
                            if(!self::checkParamValue($checkType, $itemData, $paramValueItem, $isCheckType)){
                                $paramValueJson         = CommJson::encodeArray(['paramValue' => $paramValueItem, 'paramKey' => implode('.', array_slice($paramNameList, 0, $paramNameIndex)).'.'.$paramValueIndex.'.'.implode('.', array_slice($paramNameList, $paramNameIndex+1))]);
                                return false;
                            }
                        }
                    }
                    continue 2;
                }else{
                    $paramNameItemKey   = preg_match('/^\d+$/', $paramNameItem) ? intval($paramNameItem) : $paramNameItem;
                    $isExists           = is_array($paramValue) && array_key_exists($paramNameItemKey, $paramValue);
                    if(!$isExists){
                        if($isOptional){
                            continue 2;
                        }else{
                            if(strpos($paramName, '.') !== false) continue 2; // 非顶级且父级
                            $paramValueJson = CommJson::encodeArray(['paramValue' => $paramValue]);
                            return false;
                        }
                    }
                    $paramValue     = $paramValue[$paramNameItemKey];
                }
            }
            $paramValueJson     = CommJson::encodeArray(['paramValue' => $paramValue]);
            if(!$isExists)  return false;
            if(!self::checkParamValue($checkType, $itemData, $paramValue, $isCheckType)) return false;
        }
        return true;
    }

    /**
     * @param string $checkType
     * @param array $itemData
     * @param $paramValue
     * @param bool $isCheckType
     * @return bool
     * 检查参数值合法
     */
    private static function checkParamValue(string $checkType, array $itemData, $paramValue, bool $isCheckType = true):bool
    {
        switch ($checkType){
            case self::CHECK_TYPE_NUMBER : {            // 检查类型-数字
                if(!is_int($paramValue)){
                    if($isCheckType) return false;
                    if(!(is_string($paramValue) && is_numeric($paramValue))) return false;
                }
                if($paramValue < $itemData[4] || $paramValue > $itemData[5]) return false;
                break;
            }
            case self::CHECK_TYPE_NUMBER_STR_LEN : {    // 检查类型-数字字符串内容
                if(!is_string($paramValue)) return false;
                $paramValueLength   = strlen($paramValue);
                if($paramValueLength < 1 || !CommValid::isNumber($paramValue)) return false;
                if($paramValueLength < $itemData[4] || $paramValueLength > $itemData[5]) return false;
                break;
            }
            case self::CHECK_TYPE_NUMBER_STR_INT : {    // 检查类型-数字字符串数
                if(!is_string($paramValue) || strlen($paramValue) < 1 || !CommValid::isNumber($paramValue)) return false;
                $paramValueTmp      = intval($paramValue);
                if($paramValueTmp < $itemData[4] || $paramValueTmp > $itemData[5]) return false;
                break;
            }
            case self::CHECK_TYPE_STRING : {            // 检查类型-字符串
                if(!is_string($paramValue)) return false;
                $paramValueLength   = CommString::strLenWord($paramValue);
                if($paramValueLength < $itemData[4] || $paramValueLength > $itemData[5]) return false;
                break;
            }
            case self::CHECK_TYPE_FLOAT : {             // 检查类型-浮点数
                if(!is_float($paramValue)){
                    if($isCheckType) return false;
                    if(!(is_string($paramValue) && preg_match('/^(-)?\d+\.(\d+)$/', $paramValue))) return false;
                }
                if($paramValue < $itemData[4] || $paramValue > $itemData[5]) return false;
                $floatNum           = strlen(rtrim(strval(intval(($paramValue - intval($paramValue)) * pow(10, self::FLOAT_DOT_MAX_NUM))), '0'));
                if($floatNum < 1 || $floatNum < $itemData[6] || $floatNum > $itemData[7]) return false;
                break;
            }
            case self::CHECK_TYPE_FLOAT_STR : {         // 检查类型-浮点数字符串
                if(!is_string($paramValue) || strlen($paramValue) < 1) return false;
                if(strpos($paramValue, '.') === false){
                    if(!preg_match('/^(-)?\d+$/', $paramValue)) return false;
                    $floatNum       = 0;
                }else{
                    if(!preg_match('/^(-)?\d+\.(\d+)$/', $paramValue, $match)) return false;
                    $floatNum       = strlen($match[2]);
                }
                if($floatNum < 1 || $floatNum < $itemData[6] || $floatNum > $itemData[7]) return false;
                if(bccomp($paramValue, $itemData[4], $itemData[7]) === -1 || bccomp($paramValue, $itemData[5], $itemData[7]) === 1) return false;
                break;
            }
            case self::CHECK_TYPE_ENUM : {              // 检查类型-玫举-玫举数组-是否严格模式
                if(!in_array($paramValue, $itemData[4], $itemData[5])) return false;
                break;
            }
            case self::CHECK_TYPE_BOOL : {              // 检查类型-Boolean-是否允许FALSE-是否允许TRUE
                if(!is_bool($paramValue) || (!$itemData[4] && !$paramValue) || (!$itemData[5] && $paramValue)) return false;
                break;
            }
            case self::CHECK_TYPE_ARRAY : {             // 检查类型-数组-混合
                if(!is_array($paramValue)) return false;
                $paramValueNum      = count($paramValue);
                if($paramValueNum < $itemData[4] || $paramValueNum > $itemData[5]) return false;
                break;
            }
            case self::CHECK_TYPE_ARRAY_NUM : {         // 检查类型-数组-数字
                if(!is_array($paramValue)) return false;
                $paramValueNum      = count($paramValue);
                if($paramValueNum < $itemData[4] || $paramValueNum > $itemData[5]) return false;
                if($paramValueNum > 0) foreach ($paramValue as $item){
                    if(!is_int($item)){
                        if($isCheckType) return false;
                        if(!(is_string($item) && is_numeric($item))) return false;
                    }
                    if($item < $itemData[6] || $item > $itemData[7]) return false;
                }
                break;
            }
            case self::CHECK_TYPE_ARRAY_STR : {         // 检查类型-数组-字符串
                if(!is_array($paramValue)) return false;
                $paramValueNum      = count($paramValue);
                if($paramValueNum < $itemData[4] || $paramValueNum > $itemData[5]) return false;
                if($paramValueNum > 0) foreach ($paramValue as $item){
                    if(!is_string($item)) return false;
                    $itemLength     = CommString::strLenWord($item);
                    if($itemLength < $itemData[6] || $itemLength > $itemData[7]) return false;
                }
                break;
            }
            case self::CHECK_TYPE_ARRAY_FLOAT : {       // 检查类型-数组-浮点数
                if(!is_array($paramValue)) return false;
                $paramValueNum      = count($paramValue);
                if($paramValueNum < $itemData[4] || $paramValueNum > $itemData[5]) return false;
                if($paramValueNum > 0) foreach ($paramValue as $item){
                    if(!is_float($item)){
                        if($isCheckType) return false;
                        if(!(is_string($item) && preg_match('/^(-)?\d+\.(\d+)$/', $item))) return false;
                    }
                    if($item < $itemData[6] || $item > $itemData[7]) return false;
                    $floatNum       = strlen(rtrim(strval(intval(($item - intval($item)) * pow(10, self::FLOAT_DOT_MAX_NUM))), '0'));
                    if($floatNum < 1 || $floatNum < $itemData[8] || $floatNum > $itemData[9]) return false;
                }
                break;
            }
            case self::CHECK_TYPE_ARRAY_FLOAT_STR : {   // 检查类型-数组-浮点数字符串
                if(!is_array($paramValue)) return false;
                $paramValueNum      = count($paramValue);
                if($paramValueNum < $itemData[4] || $paramValueNum > $itemData[5]) return false;
                if($paramValueNum > 0) foreach ($paramValue as $item){
                    if(!is_string($item) || strlen($item) < 1) return false;
                    if(strpos($item, '.') === false){
                        if(!preg_match('/^(-)?\d+$/', $item, $match)) return false;
                        $floatNum   = 0;
                    }else{
                        if(!preg_match('/^(-)?\d+\.(\d+)$/', $item, $match)) return false;
                        $floatNum   = strlen($match[2]);
                    }
                    if($floatNum < 1 || $floatNum < $itemData[8] || $floatNum > $itemData[9]) return false;
                    if(bccomp($item, $itemData[6], $itemData[9]) === -1 || bccomp($item, $itemData[7], $itemData[9]) === 1) return false;
                }
                break;
            }
            case self::CHECK_TYPE_ARRAY_ENUM : {        // 检查类型-数组-枚举
                if(!is_array($paramValue)) return false;
                $paramValueNum      = count($paramValue);
                if($paramValueNum < $itemData[4] || $paramValueNum > $itemData[5]) return false;
                if($paramValueNum > 0) foreach ($paramValue as $item){
                    if(!in_array($item, $itemData[6], $itemData[7])) return false;
                }
                break;
            }
            case self::CHECK_TYPE_ARRAY_BOOL : {        // 检查类型-数组-Boolean-是否允许FALSE-是否允许TRUE
                if(!is_array($paramValue)) return false;
                $paramValueNum      = count($paramValue);
                if($paramValueNum < $itemData[4] || $paramValueNum > $itemData[5]) return false;
                if($paramValueNum > 0) foreach ($paramValue as $item){
                    if(!is_bool($item) || (!$itemData[4] && !$item) || (!$itemData[5] && $item)) return false;
                }
                break;
            }
            case self::CHECK_TYPE_CLASS_ENUM : {            // 检查类-枚举
                $checkSet               = $itemData[5]??[];
                if(!is_array($checkSet)) $checkSet = [];
                if(isset($checkSet['null']) && $checkSet['null'] && is_null($paramValue)) return true;
                if(!is_int($paramValue)) return false;
                if(isset($checkSet['noZero']) && $checkSet['noZero'] && $paramValue === 0) return false;
                if(isset($checkSet['onlyList']) && is_array($checkSet['onlyList']) && !in_array($paramValue, $checkSet['onlyList'], true)) return false;
                if(isset($checkSet['notList']) && is_array($checkSet['notList']) && in_array($paramValue, $checkSet['notList'], true)) return false;
                $classNameEnum          = $itemData[4];
                if(strlen($classNameEnum) < 1 || !CommValid::isExistsClass($classNameEnum)) return false;
                $classNameObjectEnum    = new $classNameEnum();
                if(!($classNameObjectEnum instanceof EnumAbstract)) return false;
                $valueList              = @call_user_func_array([$classNameEnum, 'getValueList'], []);
                if(count($valueList) < 1) return false;
                if(!in_array($paramValue, $valueList, true)) return false;
                break;
            }
            case self::CHECK_TYPE_CLASS_ARRAY_ENUM : {      // 检查类-数组-枚举
                $checkSet               = $itemData[7]??[];
                if(!is_array($checkSet)) $checkSet = [];
                if(isset($checkSet['null']) && $checkSet['null'] && is_null($paramValue)) return true;
                if(!is_array($paramValue)) return false;
                $paramValueNum          = count($paramValue);
                if($paramValueNum < $itemData[4] || $paramValueNum > $itemData[5]) return false;
                $classNameEnum          = $itemData[6];
                if(strlen($classNameEnum) < 1 || !CommValid::isExistsClass($classNameEnum)) return false;
                $classNameObjectEnum    = new $classNameEnum();
                if(!($classNameObjectEnum instanceof EnumAbstract)) return false;
                $valueList              = @call_user_func_array([$classNameEnum, 'getValueList'], []);
                if(count($valueList) < 1) return false;
                if($paramValueNum > 0) foreach ($paramValue as $item){
                    if(!is_int($item)) return false;
                    if(!in_array($item, $valueList, true)) return false;
                    if(isset($checkSet['noZero']) && $checkSet['noZero'] && $item === 0) return false;
                    if(isset($checkSet['onlyList']) && is_array($checkSet['onlyList']) && !in_array($item, $checkSet['onlyList'], true)) return false;
                    if(isset($checkSet['notList']) && is_array($checkSet['notList']) && in_array($item, $checkSet['notList'], true)) return false;
                }
                break;
            }
            case self::CHECK_TYPE_CLASS_MESSAGE : {         // 检查类-对象
                $checkSet               = $itemData[5]??[];
                if(!is_array($checkSet)) $checkSet = [];
                if(isset($checkSet['null']) && $checkSet['null'] && is_null($paramValue)) return true;
                if(!is_array($paramValue)) return false;
                $classNameDTO           = $itemData[4];
                if(strlen($classNameDTO) < 1 || !CommValid::isExistsClass($classNameDTO)) return false;
                $classNameObjectDTO     = new $classNameDTO();
                if(!($classNameObjectDTO instanceof DTOAbstract)) return false;
                break;
            }
            case self::CHECK_TYPE_CLASS_ARRAY_MESSAGE : {   // 检查类-数组-对象
                $checkSet               = $itemData[7]??[];
                if(!is_array($checkSet)) $checkSet = [];
                if(isset($checkSet['null']) && $checkSet['null'] && is_null($paramValue)) return true;
                if(!is_array($paramValue)) return false;
                $paramValueNum          = count($paramValue);
                if($paramValueNum < $itemData[4] || $paramValueNum > $itemData[5]) return false;
                $classNameDTO           = $itemData[6];
                if(strlen($classNameDTO) < 1 || !CommValid::isExistsClass($classNameDTO)) return false;
                $classNameObjectDTO     = new $classNameDTO();
                if(!($classNameObjectDTO instanceof DTOAbstract)) return false;
                if($paramValueNum > 0) foreach ($paramValue as $item){
                    if(!is_array($item)) return false;
                    if(count($item) < 1) return false;
                }
                break;
            }
            case self::CHECK_TYPE_VALID : {             // 检查类型-验证
                if(!self::checkParamValid($itemData[4], $paramValue, $itemData[5])) return false;
                break;
            }
            default: {                                  // 不支持的检查类型
                return false;
            }
        }
        return true;
    }

    /**
     * @param int $validType
     * @param $paramValue
     * @param array $validData
     * @return bool
     * 检查参数验证合法
     */
    private static function checkParamValid(int $validType, $paramValue, array $validData):bool
    {
        switch ($validType){
            case self::VALID_IP : {                     // IP地址
                if(!is_string($paramValue)) return false;
                return CommValid::isIp($paramValue);
            }
            case self::VALID_IPv6 : {                   // IPv6地址
                if(!is_string($paramValue)) return false;
                return CommValid::isIpv6($paramValue);
            }
            case self::VALID_MAC : {                    // MAC地址
                if(!is_string($paramValue)) return false;
                return CommValid::isMac($paramValue);
            }
            case self::VALID_TIME : {                   // 时间
                if(!is_string($paramValue)) return false;
                return CommValid::isTime($paramValue);
            }
            case self::VALID_DATE : {                   // 日期
                if(!is_string($paramValue)) return false;
                return CommValid::isDate($paramValue);
            }
            case self::VALID_DATE_TIME : {              // 日期+时间
                if(!is_string($paramValue)) return false;
                return CommValid::isDateTime($paramValue);
            }
            case self::VALID_EMAIL : {                  // Email
                if(!is_string($paramValue)) return false;
                return CommValid::isEmail($paramValue);
            }
            case self::VALID_MOBILE : {                 // 手机号
                if(!is_string($paramValue)) return false;
                return CommValid::isMobile($paramValue);
            }
            case self::VALID_PHONE : {                  // 座机号
                if(!is_string($paramValue)) return false;
                return CommValid::isPhone($paramValue);
            }
            case self::VALID_IDCARD : {                 // 身份证号
                if(!is_string($paramValue)) return false;
                return CommValid::isIdCardReal($paramValue);
            }
            case self::VALID_AGE : {                    // 年龄
                is_int($paramValue) && $paramValue = strval($paramValue);
                if(!is_string($paramValue)) return false;
                return CommValid::isAge($paramValue);
            }
            case self::VALID_GENDER : {                 // 性别
                if(!is_int($paramValue)) return false;
                return CommValid::isGender($paramValue);
            }
            case self::VALID_CHINESE : {                // 仅中文
                if(!is_string($paramValue)) return false;
                return CommValid::isChinese($paramValue);
            }
            case self::VALID_ENGLISH : {                // 仅英文
                if(!is_string($paramValue)) return false;
                return CommValid::isEnglish($paramValue);
            }
            case self::VALID_NUMBER : {                 // 仅数字
                is_int($paramValue) && $paramValue = strval($paramValue);
                if(!is_string($paramValue)) return false;
                return CommValid::isNumber($paramValue);
            }
            case self::VALID_ENGLISH_NUMBER : {         // 仅英文+数字
                if(!is_string($paramValue)) return false;
                return CommValid::isEnglishAndNumber($paramValue);
            }
            case self::VALID_HTTP : {                   // http链接地址
                if(!is_string($paramValue)) return false;
                return CommValid::isHttp($paramValue);
            }
            case self::VALID_HTTPS : {                  // https链接地址
                if(!is_string($paramValue)) return false;
                return CommValid::isHttps($paramValue);
            }
            case self::VALID_HTTP_HTTPS : {             // http+https链接地址
                if(!is_string($paramValue)) return false;
                return CommValid::isHttp($paramValue) || CommValid::isHttps($paramValue);
            }
            case self::VALID_HTTP_ALL : {               // 全链接地址
                if(!is_string($paramValue)) return false;
                return CommValid::isAllWeb($paramValue);
            }
            case self::VALID_QQ : {                     // QQ号码
                if(!is_string($paramValue)) return false;
                return CommValid::isQq($paramValue);
            }
            case self::VALID_POST_CODE : {              // 邮政编号
                if(!is_string($paramValue)) return false;
                return CommValid::isPostCode($paramValue);
            }
            case self::VALID_DOMAIN_EN : {              // 英文域名
                if(!is_string($paramValue)) return false;
                return CommValid::isDomain($paramValue);
            }
            case self::VALID_DOMAIN_CN : {              // 中文域名
                if(!is_string($paramValue)) return false;
                return CommValid::isCnDomain($paramValue);
            }
            case self::VALID_HOST_NAME_EN : {           // 英文主机名
                if(!is_string($paramValue)) return false;
                return CommValid::isHost($paramValue);
            }
            case self::VALID_HOST_NAME_CN : {           // 中文主机名
                if(!is_string($paramValue)) return false;
                return CommValid::isCnHost($paramValue);
            }
            case self::VALID_TIME_STAMP : {             // 时间秒
                if(!is_int($paramValue)) return false;
                if(isset($validData['zero']) && $validData['zero'] && $paramValue === 0) return true;
                if($paramValue < 1 || strlen(strval($paramValue)) !== 10) return false;
                if(isset($validData['min']) && (!is_int($validData['min']) || $paramValue < $validData['min'])) return false;
                if(isset($validData['max']) && (!is_int($validData['max']) || $paramValue > $validData['max'])) return false;
                if(isset($validData['abs']) && (!is_int($validData['abs']) || abs(CommTime::getTimeStamp() - $paramValue) > $validData['abs'])) return false;
                if(isset($validData['minCurr']) && (!is_int($validData['minCurr']) || $paramValue < ($validData['minCurr'] + CommTime::getTimeStamp()))) return false;
                if(isset($validData['maxCurr']) && (!is_int($validData['maxCurr']) || $paramValue > ($validData['maxCurr'] + CommTime::getTimeStamp()))) return false;
                return true;
            }
            case self::VALID_TIME_MILLI : {             // 时间毫秒
                if(!is_int($paramValue)) return false;
                if(isset($validData['zero']) && $validData['zero'] && $paramValue === 0) return true;
                if($paramValue < 1 || strlen(strval($paramValue)) !== 13) return false;
                if(isset($validData['min']) && (!is_int($validData['min']) || $paramValue < $validData['min'])) return false;
                if(isset($validData['max']) && (!is_int($validData['max']) || $paramValue > $validData['max'])) return false;
                if(isset($validData['abs']) && (!is_int($validData['abs']) || abs(CommTime::getTimeMilli() - $paramValue) > $validData['abs'])) return false;
                if(isset($validData['minCurr']) && (!is_int($validData['minCurr']) || $paramValue < ($validData['minCurr'] + CommTime::getTimeMilli()))) return false;
                if(isset($validData['maxCurr']) && (!is_int($validData['maxCurr']) || $paramValue > ($validData['maxCurr'] + CommTime::getTimeMilli()))) return false;
                return true;
            }
            case self::VALID_UUID : {                   // UUID[8-4-4-4-12]
                if(!is_string($paramValue)) return false;
                return CommValid::isUuId($paramValue);
            }
            case self::VALID_VERSION : {                // 版本字符串[1.0.0]
                if(!is_string($paramValue)) return false;
                return CommValid::isVersion($paramValue);
            }
            case self::VALID_VERSION_FULL : {           // 版本字符串[1.0.0.1]
                if(!is_string($paramValue)) return false;
                return CommValid::isVersionFull($paramValue);
            }
            case self::VALID_POS_LNG : {                // 位置经度[0.000000]
                if(!is_string($paramValue)) return false;
                if(isset($validData['empty']) && $validData['empty'] && strlen($paramValue) < 1) return true;
                return CommValid::isLocationLng($paramValue, boolval($validData['zero']??false));
            }
            case self::VALID_POS_LAT : {                // 位置纬度[0.000000]
                if(!is_string($paramValue)) return false;
                if(isset($validData['empty']) && $validData['empty'] && strlen($paramValue) < 1) return true;
                return CommValid::isLocationLat($paramValue, boolval($validData['zero']??false));
            }
            case self::VALID_APPLE_ID : {               // 苹果唯一Key[IDFA或IDFV]
                if(!is_string($paramValue)) return false;
                return CommValid::isAppleId($paramValue);
            }
            case self::VALID_ANDROID_IMEI : {           // 安卓IMEI
                if(!is_string($paramValue)) return false;
                return CommValid::isAndroidImei($paramValue);
            }
            case self::VALID_ANDROID_SN : {             // 安卓SN
                if(!is_string($paramValue)) return false;
                return CommValid::isAndroidSn($paramValue);
            }
            case self::VALID_ANDROID_OAID : {           // 安卓OAID
                if(!is_string($paramValue)) return false;
                return CommValid::isAndroidOaId($paramValue);
            }
            case self::VALID_ANDROID_GAID : {           // 安卓GAID
                if(!is_string($paramValue)) return false;
                return CommValid::isAndroidGaId($paramValue);
            }
            case self::VALID_WEB3_ADDRESS : {           // Web3地址
                if(!is_string($paramValue)) return false;
                return CommValid::isWeb3($paramValue);
            }
            case self::VALID_WEB3_HASH : {              // Web3交易Hash
                if(!is_string($paramValue)) return false;
                return CommValid::isWeb3Hash($paramValue);
            }
            case self::VALID_MD5_LOWER : {              // md5小写值
                if(!is_string($paramValue) || strlen($paramValue) !== 32) return false;
                return CommValid::isMd5Lower($paramValue);
            }
            case self::VALID_MD5_UPPER : {              // md5大写值
                if(!is_string($paramValue) || strlen($paramValue) !== 32) return false;
                return CommValid::isMd5Upper($paramValue);
            }
            case self::VALID_SHA1_LOWER : {             // sha1小写值
                if(!is_string($paramValue) || strlen($paramValue) !== 40) return false;
                return CommValid::isSha1Lower($paramValue);
            }
            case self::VALID_SHA1_UPPER : {             // sha1大写值
                if(!is_string($paramValue) || strlen($paramValue) !== 40) return false;
                return CommValid::isSha1Upper($paramValue);
            }
        }
        return false;
    }
}